const jwt = require('jsonwebtoken');
const config = require('../config/config')
module.exports = {
  genToken(data) {
    const token = jwt.sign(data,
      config.jwt.secretKey, {
      expiresIn: config.jwt.expiresIn
    }
    )
    return token
  },
  deCodeToken(token) {
    return jwt.verify(token, config.jwt.secretKey, {
      expiresIn: config.jwt.expiresIn
    })
  }
}